/*****************************************************************************
*  Copyright Statement:
*  --------------------
*  This software is protected by Copyright and the information contained
*  herein is confidential. The software may not be copied and the information
*  contained herein may not be used or disclosed except with the written
*  permission of MediaTek Inc. (C) 2005
*
*  BY OPENING THIS FILE, BUYER HEREBY UNEQUIVOCALLY ACKNOWLEDGES AND AGREES
*  THAT THE SOFTWARE/FIRMWARE AND ITS DOCUMENTATIONS ("MEDIATEK SOFTWARE")
*  RECEIVED FROM MEDIATEK AND/OR ITS REPRESENTATIVES ARE PROVIDED TO BUYER ON
*  AN "AS-IS" BASIS ONLY. MEDIATEK EXPRESSLY DISCLAIMS ANY AND ALL WARRANTIES,
*  EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
*  MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR NONINFRINGEMENT.
*  NEITHER DOES MEDIATEK PROVIDE ANY WARRANTY WHATSOEVER WITH RESPECT TO THE
*  SOFTWARE OF ANY THIRD PARTY WHICH MAY BE USED BY, INCORPORATED IN, OR
*  SUPPLIED WITH THE MEDIATEK SOFTWARE, AND BUYER AGREES TO LOOK ONLY TO SUCH
*  THIRD PARTY FOR ANY WARRANTY CLAIM RELATING THERETO. MEDIATEK SHALL ALSO
*  NOT BE RESPONSIBLE FOR ANY MEDIATEK SOFTWARE RELEASES MADE TO BUYER'S
*  SPECIFICATION OR TO CONFORM TO A PARTICULAR STANDARD OR OPEN FORUM.
*
*  BUYER'S SOLE AND EXCLUSIVE REMEDY AND MEDIATEK'S ENTIRE AND CUMULATIVE
*  LIABILITY WITH RESPECT TO THE MEDIATEK SOFTWARE RELEASED HEREUNDER WILL BE,
*  AT MEDIATEK'S OPTION, TO REVISE OR REPLACE THE MEDIATEK SOFTWARE AT ISSUE,
*  OR REFUND ANY SOFTWARE LICENSE FEES OR SERVICE CHARGE PAID BY BUYER TO
*  MEDIATEK FOR SUCH MEDIATEK SOFTWARE AT ISSUE.
*
*  THE TRANSACTION CONTEMPLATED HEREUNDER SHALL BE CONSTRUED IN ACCORDANCE
*  WITH THE LAWS OF THE STATE OF CALIFORNIA, USA, EXCLUDING ITS CONFLICT OF
*  LAWS PRINCIPLES.  ANY DISPUTES, CONTROVERSIES OR CLAIMS ARISING THEREOF AND
*  RELATED THERETO SHALL BE SETTLED BY ARBITRATION IN SAN FRANCISCO, CA, UNDER
*  THE RULES OF THE INTERNATIONAL CHAMBER OF COMMERCE (ICC).
*
*****************************************************************************/
/*****************************************************************************
 *
 * Filename:
 * ---------
 *
 *
 * Project:
 * --------
 *  MAUI
 *
 * Description:
 * ------------
 *
 *
 * Author:
 * -------
 * -------
 * -------
 *
 *============================================================================
 *             HISTORY
 * Below this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *------------------------------------------------------------------------------
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 * removed!
 * removed!
 * removed!
 *
 *------------------------------------------------------------------------------
 * Upper this line, this part is controlled by PVCS VM. DO NOT MODIFY!!
 *============================================================================
 ****************************************************************************/
/****************************************************************************
* Include Files                                                                
*****************************************************************************/
/* add for RHR begin */
#include "MMI_features.h"
/* add for RHR end */
#include "MMI_include.h"


#include "CommonScreens.h"
#include "ProtocolEvents.h"

/* Temprary */
#include "drm_def.h"
#include "FileMgrGProt.h"
#include "FileMgrServicehdlr.h"
#include "FileMgrServiceResDef.h"
#include "fmt_struct.h"
#include "FileMgrSrvGProt.h"

#if defined(__MMI_FILE_MANAGER__)

#include "SimDetectionGprot.h"
#include "ProfileGprots.h"
#include "Wapadp.h"
#include "Drm_gprot.h"
#include "ImageViewerGprot.h"
#include "PhotoEditorGProt.h"
#include "PictBridgeGProt.h"
#include "PhoneSetupGprots.h"
#ifdef __MMI_AUDIO_PLAYER__
#include "mdi_datatype.h"
#include "AudioPlayerDef.h"
#endif 
#ifdef __MMI_AB_REPEATER__
#include "ABRepeaterProt.h"
#endif
#include "MediaAppGProt.h"
#ifdef __MMI_MEDIA_PLAYER__
#include "MediaPlayerGProt.h"
#endif

#ifdef __MMI_VIDEO_PLAYER__
#include "mmi_features_video.h"
#include "vdoplyResDef.h"
#include "vdoplyGprot.h"
#include "mmi_rp_app_vdoply_def.h"
#endif

#ifdef __MMI_ULC_VIDEO_PLAYER__
#include "mmi_features_video.h"
#include "vdoplyResDef.h"
#include "vdoplyGprot.h"
#endif

#ifdef __MMI_MESSAGES_EMS__
#include "MessagesExDcl.h"
#endif

#ifdef __MMI_BT_SEND_SUPPORT__
#include "BTSendCuiGProt.h"
#endif 


#ifdef __MMI_DSM_NEW__
#include "mrp_include.h"
#endif



#ifdef __CERTMAN_SUPPORT__
#include "CertManMMIGprots.h"
#endif
#ifdef __MMI_MMS_BGSR_SUPPORT__
#include "MMSBGSRGProt.h"
#endif
#include "mdi_datatype.h"
#include "mdi_video.h"      // for mmi_fmgr_util_file_limit_check()

#include "RightsMgrGProt.h"

#include "vCard.h"
#include "vCalendar.h"
#include "Vcalsrvgprot.h"
#include "vBookmark.h"

#ifdef __MMI_MY_FAVORITE__
/* under construction !*/
/* under construction !*/
#endif

#ifdef __SYNCML_SUPPORT__
#include "SyncMLResDef.h"
#include "SyncMLGprot.h"
#endif

#ifdef __J2ME__
#include "JavaAgencyGProt.h"
#include "JavaAgencyDef.h"
#include "Jma_interface.h"
#include "Jvm_adaptor.h"
#include "jam_internal.h"
/* for RHR begin */
#include "mmi_rp_app_java_def.h"
/* for RHR end */
#endif

#ifdef __MMI_MMS_2__
#include "MMSAppInterfaceGprot.h"
#endif

#include "PhoneBookGprot.h"
#include "BGSoundGProt.h"
#ifdef __MMI_EBOOK_READER__
#include "EbookGprot.h"
#endif
#include "UMGProt.h"
#include "UcAppGprot.h"
#include "BrowserGprots.h"
#include "SmsSrvGprot.h"
#ifdef __MMI_EMAIL__
#include "EmailAppGProt.h"
#endif
#include "Wapadp.h"

#include "Mmsadp.h"

#ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
#include "MMIThemesGprot.h"
#endif
#endif

#ifdef __MMI_VCALENDAR__
//#include "ToDoListDef.h"
#include "ToDoListGprot.h"
#include "ToDoListProt.h"
#endif

#include "MMI_features_camera.h"

#include "ComposeRingToneProts.h"

#ifdef __MMI_IMPS__
/* under construction !*/
#endif
#if defined(__MMI_RING_COMPOSER__) && defined(__MMI_IMELODY_SUPPORT__)
#include "ComposeRingToneProts.h"
#endif

#include "BTMMIScrGprots.h"

#if defined(__DM_LAWMO_SUPPORT__)
#include "dmuigprot.h"
#endif

#include "ImageViewCuiGprot.h"
#include "mmi_rp_app_imageviewer_def.h"

#if defined (OBIGO_Q03C_MMS_V01)
#include "q03c_mms_V01_agentgprot.h"
#endif

#if defined(__MMI_FE_VECTOR_FONT_ON_FILE_SYSTEM__)
#include "FontManagerGProt.h"
#endif

#ifdef __MMI_PICT_BRIDGE_SUPPORT__
#include "PictCuiGprot.h"
#endif

#include "mmi_rp_app_phoedt_def.h"
/* add for RHR begin */
#include "gdi_const.h"
#include "MMIDataType.h"
#include "lcd_sw_inc.h"
#include "kal_non_specific_general_types.h"
#include "mmi_rp_file_type_def.h"
#include "CustMenuRes.h"
#include "GlobalResDef.h"
#include "CustDataRes.h"
#include "mmi_frm_events_gprot.h"
#include "mmi_rp_srv_syncml_def.h"
#include "AlertScreen.h"
#include "GlobalConstants.h"
#include "mmi_frm_input_gprot.h"
#include "wgui_categories_util.h"
#include "wgui_touch_screen.h"
#include "GlobalMenuItems.h"
#include "mmi_res_range_def.h"
#include "FileMgrType.h"
#ifdef __VRE30_AM__
#include "vmsys.h"
#endif
#include "Conversions.h"
#include "fs_type.h"
#include "mmi_rp_app_filemanager_def.h"
#include "fs_func.h"
#include "mmi_frm_scenario_gprot.h"
#include "mmi_frm_history_gprot.h"
#include "kal_release.h"
#include "Unicodexdcl.h"
#include "gui_typedef.h"
#include "mmi_frm_mem_gprot.h"
#include "app_buff_alloc.h"
#include "wgui_categories_list.h"
#include "string.h"
#include "DebugInitDef_Int.h"
#include "gui_data_types.h"
#include "fs_errcode.h"
#include "gdi_include.h"
/* add for RHR end */
#include "TimerEvents.h"

/****************************************************************************
* Define
*****************************************************************************/

/* 
 * size     : Kbyte
 * width    : pixel  
 * height   : pixel     
 */
#define IMG_BMP_LIMIT_ITEM(size,width,height)   GDI_IMAGE_TYPE_BMP_FILE,size,width,height
#define IMG_JPG_LIMIT_ITEM(size,width,height)   GDI_IMAGE_TYPE_JPG_FILE,size,width,height
#define IMG_GIF_LIMIT_ITEM(size,width,height)   GDI_IMAGE_TYPE_GIF_FILE,size,width,height
#define IMG_WBMP_LIMIT_ITEM(size,width,height)  GDI_IMAGE_TYPE_WBMP_FILE,size,width,height
#define IMG_PNG_LIMIT_ITEM(size,width,height)   GDI_IMAGE_TYPE_PNG_FILE,size,width,height
#define IMG_M3D_LIMIT_ITEM(size,width,height)   GDI_IMAGE_TYPE_M3D_FILE,size,width,height

#ifdef SVG12_SUPPORT
    #define IMG_SVG_LIMIT_ITEM(size,width,height)   GDI_IMAGE_TYPE_SVG_FILE,0,0,0
#else
    #define IMG_SVG_LIMIT_ITEM(size,width,height)   GDI_IMAGE_TYPE_SVG_FILE,size,width,height
#endif

/* 
 * size     : Kbyte
 * duration : sec       
 * width    : pixel  
 * height   : pixel     
 */
#define VDO_3GP_LIMIT_ITEM(size,duration,width,height)      GDI_IMAGE_TYPE_3GP_FILE,size,duration,width,height
#define VDO_MP4_LIMIT_ITEM(size,duration,width,height)      GDI_IMAGE_TYPE_MP4_FILE,size,duration,width,height
#define VDO_AVI_LIMIT_ITEM(size,duration,width,height)      GDI_IMAGE_TYPE_AVI_FILE,size,duration,width,height
#define VDO_SWFLASH_LIMIT_ITEM(size,duration,width,height)  GDI_IMAGE_TYPE_SWFLASH_FILE,size,duration,width,height

#define END_LIMIT_ITEM     GDI_IMAGE_TYPE_INVALID


/****************************************************************************
* Global Variable
*****************************************************************************/


/****************************************************************************
* Static Variable
*****************************************************************************/

const S32 g_fmgr_image_viewer_limit_arry[] = 
{
#if defined(MT6225)
    IMG_JPG_LIMIT_ITEM(1230, 0, 0),
    IMG_WBMP_LIMIT_ITEM(1536, 2048, 2048),
    IMG_BMP_LIMIT_ITEM(6656, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, 1280, 1280),
    IMG_PNG_LIMIT_ITEM(0, 640, 480),
    IMG_SVG_LIMIT_ITEM(0, 0, 0),
    IMG_M3D_LIMIT_ITEM(200, 0, 0),
#elif defined(MT6226) || defined(MT6226M) || defined(MT6227) || defined(MT6227D)
    IMG_JPG_LIMIT_ITEM(2253, 0, 0),
    IMG_WBMP_LIMIT_ITEM(1536, 2048, 2048),
    IMG_BMP_LIMIT_ITEM(1230, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, 640, 640),
    IMG_PNG_LIMIT_ITEM(0, 480, 320),
    IMG_SVG_LIMIT_ITEM(0, 0, 0),
    IMG_M3D_LIMIT_ITEM(200, 0, 0),
#elif defined(MT6228) || defined(MT6229) || defined(MT6230) || defined(MT6235) || defined(MT6235B)
    IMG_JPG_LIMIT_ITEM(3175, 0, 0),
    IMG_WBMP_LIMIT_ITEM(1536, 2048, 2048),
    IMG_BMP_LIMIT_ITEM(16384, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, 1280, 1280),
    IMG_PNG_LIMIT_ITEM(0, 1024, 768),
    IMG_SVG_LIMIT_ITEM(125, 0, 0),
    IMG_M3D_LIMIT_ITEM(200, 0, 0),
#elif defined(MT6238) || defined(MT6239) || defined(MT6268) || defined(MT6268A) || defined(MT6236) || defined(MT6236B)
    IMG_JPG_LIMIT_ITEM(12000, 4095, 4095),
    IMG_WBMP_LIMIT_ITEM(1536, 2048, 2048),
    IMG_BMP_LIMIT_ITEM(25000, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, 2300, 2300),
    IMG_PNG_LIMIT_ITEM(0, 2047, 4096),
    IMG_SVG_LIMIT_ITEM(125, 0, 0),
    IMG_M3D_LIMIT_ITEM(200, 0, 0),
#elif defined(MT6253) || defined(MT6253T)
    IMG_JPG_LIMIT_ITEM(1000, 0, 0),
    IMG_WBMP_LIMIT_ITEM(1536, 2048, 2048),
    IMG_BMP_LIMIT_ITEM(1500, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, 1200, 1200),
    IMG_PNG_LIMIT_ITEM(0, 700, 700),
    IMG_SVG_LIMIT_ITEM(125, 0, 0),
    IMG_M3D_LIMIT_ITEM(200, 0, 0),
#else
    IMG_JPG_LIMIT_ITEM(0, 0, 0),
    IMG_WBMP_LIMIT_ITEM(512, 1536, 1536),
    IMG_BMP_LIMIT_ITEM(512, 1536, 1536),
    IMG_GIF_LIMIT_ITEM(0, 640, 640),
    IMG_PNG_LIMIT_ITEM(0, 0, 0),
    IMG_SVG_LIMIT_ITEM(200,0,0),
    IMG_M3D_LIMIT_ITEM(200,0,0),
#endif
    END_LIMIT_ITEM
};

const S32 g_fmgr_wallpaper_limit_arry[] = 
{
#if defined(MT6225)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(256, 0, 0),
    IMG_GIF_LIMIT_ITEM(256, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6226) || defined(MT6226M) || defined(MT6227) || defined(MT6227D)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(384, 0, 0),
    IMG_GIF_LIMIT_ITEM(384, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6228) || defined(MT6229) || defined(MT6230) || defined(MT6235) || defined(MT6235B) || defined(MT6239)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(896, 0, 0),
    IMG_GIF_LIMIT_ITEM(896, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6253)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(100, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6238) || defined(MT6268)
    IMG_BMP_LIMIT_ITEM(2500, 0, 0),
    IMG_JPG_LIMIT_ITEM(2000, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, 1280, 960),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#else
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(128, 0, 0),
    IMG_GIF_LIMIT_ITEM(128, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#endif
    END_LIMIT_ITEM
};

#ifdef __MMI_SUB_WALLPAPER__
const S32 g_fmgr_sub_wallpaper_limit_arry[] = 
{
#if defined(MT6225)
    IMG_BMP_LIMIT_ITEM(0, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_JPG_LIMIT_ITEM(128, 0, 0),
    IMG_GIF_LIMIT_ITEM(128, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6226) || defined(MT6226M) || defined(MT6227) || defined(MT6227D)
    IMG_BMP_LIMIT_ITEM(0, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_JPG_LIMIT_ITEM(384, 0, 0),
    IMG_GIF_LIMIT_ITEM(384, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6228) || defined(MT6229) || defined(MT6230) || defined(MT6235) || defined(MT6235B) || defined(MT6239)
    IMG_BMP_LIMIT_ITEM(0, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_JPG_LIMIT_ITEM(896, 0, 0),
    IMG_GIF_LIMIT_ITEM(896, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6253)
    IMG_BMP_LIMIT_ITEM(0, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_JPG_LIMIT_ITEM(100, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6238) || defined(MT6268)
    IMG_BMP_LIMIT_ITEM(2500, 0, 0),
    IMG_JPG_LIMIT_ITEM(2000, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, 1280, 960),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#else
    IMG_BMP_LIMIT_ITEM(0, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_JPG_LIMIT_ITEM(128, 0, 0),
    IMG_GIF_LIMIT_ITEM(128, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, SUBLCD_WIDTH, SUBLCD_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#endif
    END_LIMIT_ITEM
};
#endif /* __MMI_SUB_WALLPAPER__ */ 

const S32 g_fmgr_screensaver_limit_arry[] = 
{
#if defined(MT6225)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(256, 0, 0),
    IMG_GIF_LIMIT_ITEM(256, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6226) || defined(MT6226M) || defined(MT6227) || defined(MT6227D)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(512, 0, 0),
    IMG_GIF_LIMIT_ITEM(512, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6228) || defined(MT6229) || defined(MT6230) || defined(MT6235) || defined(MT6235B) || defined(MT6239)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(1024, 0, 0),
    IMG_GIF_LIMIT_ITEM(1024, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6253)
    IMG_BMP_LIMIT_ITEM(200, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(250, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6238) || defined(MT6268)
    IMG_BMP_LIMIT_ITEM(7000, 0, 0),
    IMG_JPG_LIMIT_ITEM(3500, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, 1280, 960),
    IMG_PNG_LIMIT_ITEM(0, 1600, 1200),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#else
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(128, 0, 0),
    IMG_GIF_LIMIT_ITEM(128, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#endif
    END_LIMIT_ITEM
};

const S32 g_fmgr_power_on_off_disp_limit_arry[] = 
{
#if defined(MT6225)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(128, 0, 0),
    IMG_GIF_LIMIT_ITEM(128, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6226) || defined(MT6226M) || defined(MT6227) || defined(MT6227D)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(256, 0, 0),
    IMG_GIF_LIMIT_ITEM(256, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6228) || defined(MT6229) || defined(MT6230) || defined(MT6235) || defined(MT6235B) || defined(MT6239)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(512, 0, 0),
    IMG_GIF_LIMIT_ITEM(512, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6253)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(80, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#elif defined(MT6238) || defined(MT6268)
    IMG_BMP_LIMIT_ITEM(1500, 0, 0),
    IMG_JPG_LIMIT_ITEM(1800, 0, 0),
    IMG_GIF_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#else
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(128, 0, 0),
    IMG_GIF_LIMIT_ITEM(128, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(20,0,0),
#endif
    END_LIMIT_ITEM
};


#ifdef __MMI_VIDEO_TELEPHONY__
const S32 g_fmgr_vt_img_limit_arry[] = 
{
#if defined(MT6225)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(256, 0, 0),
    IMG_GIF_LIMIT_ITEM(256, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
#elif defined(MT6226) || defined(MT6226M) || defined(MT6227) || defined(MT6227D)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(384, 0, 0),
    IMG_GIF_LIMIT_ITEM(384, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
#elif defined(MT6228) || defined(MT6229) || defined(MT6230) || defined(MT6235) || defined(MT6235B) || defined(MT6238) || defined(MT6239)
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(896, 0, 0),
    IMG_GIF_LIMIT_ITEM(896, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
#else
    IMG_BMP_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_JPG_LIMIT_ITEM(128, 0, 0),
    IMG_GIF_LIMIT_ITEM(128, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
    IMG_PNG_LIMIT_ITEM(0, UI_DEVICE_WIDTH, UI_DEVICE_HEIGHT),
#endif
    END_LIMIT_ITEM
};
#endif /*__MMI_VIDEO_TELEPHONY__*/

#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#ifdef __MMI_SUB_WALLPAPER__
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif /* __MMI_SUB_WALLPAPER__ */ 
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif /* 0 */

const S32 g_fmgr_caller_picture_limit_arry[] = 
{
    IMG_BMP_LIMIT_ITEM(20, 0, 0),
    IMG_JPG_LIMIT_ITEM(20, 0, 0),
    IMG_GIF_LIMIT_ITEM(20, 0, 0),
    IMG_PNG_LIMIT_ITEM(20, 0, 0),
    IMG_PNG_LIMIT_ITEM(20, 0, 0),    
    IMG_M3D_LIMIT_ITEM(100, 0, 0),
    IMG_SVG_LIMIT_ITEM(20, 0, 0),
    END_LIMIT_ITEM
};

const S32 g_fmgr_caller_video_limit_arry[] = 
{
    VDO_3GP_LIMIT_ITEM(50000, 0, 0, 0),
    VDO_MP4_LIMIT_ITEM(50000, 0, 0, 0),
    VDO_AVI_LIMIT_ITEM(50000, 0, 0, 0),
    VDO_SWFLASH_LIMIT_ITEM(50000, 0, 0, 0),
    END_LIMIT_ITEM
};

const S32 g_fmgr_mms_category_limit_arry[] = 
{
    IMG_JPG_LIMIT_ITEM(0, 2048, 2048),
    IMG_WBMP_LIMIT_ITEM(512, 1536, 1536),
    IMG_BMP_LIMIT_ITEM(512, 1536, 1536),
#if defined(MT6223) || defined(MT6223P) || defined(MT6226) || defined(MT6226M) || defined(MT6227) || defined(MT6227D)
    IMG_GIF_LIMIT_ITEM(0, 640, 640),
#else
    IMG_GIF_LIMIT_ITEM(0, 800, 800),
#endif
    IMG_PNG_LIMIT_ITEM(0, 640, 640),
    IMG_SVG_LIMIT_ITEM(20,0,0),
    IMG_M3D_LIMIT_ITEM(200,0,0),
    END_LIMIT_ITEM
};

#if defined(__MMI_FILE_MANAGER__)

/****************************************************************************
* Function Forward Declaration
*****************************************************************************/
void entry_fmgr_request_rights_confirm(void);

#if defined(__DM_LAWMO_SUPPORT__)
static void fmgr_dm_lawmo_hdlr(mmi_dmui_app_id_enum app_id, mmi_dmui_cmd_enum cmd);
#endif

#define END_OF_FUNCTION_DECLARATION
/****************************************************************************
* Function Body
*****************************************************************************/
#ifdef __DRM_SUPPORT__

static void _fmgr_check_drm_rights_callback(MMI_BOOL result)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
}

static BOOL _fmgr_check_drm_rights(S8* filepath, U8 drm_permission, U16 icon_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    return mmi_rmgr_check_rights_full_procedure((U16*)filepath, 0, drm_permission, icon_id, _fmgr_check_drm_rights_callback);
}
#endif

static BOOL fmgr_is_network_services_available(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    return (BOOL)mmi_bootup_is_network_service_available();
}

#define FORWARD_HANDLER

void mmi_fmgr_forward_2d_media_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    /* Disable in 2 case:
     * 1. file is EMS/ANM
     * 2. no Idle screen
     */
#ifdef __MMI_MESSAGES_EMS__
    if(
        FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_EMS) ||
        FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_ANM)
       )
    {
        mmi_frm_hide_menu_item(menu_id);
        return;
    }
#endif	
 
	
}



void mmi_fmgr_forward_phb_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    /* Disable in 1 case:
     * 1. file is EMS/ANM
     */
#ifdef __MMI_MESSAGES_EMS__
    if (FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_EMS) ||
        FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_ANM))
    {
        mmi_frm_hide_menu_item(menu_id);
        return;
    }
#endif

#ifndef SVG12_SUPPORT
    if (FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_SVG))
    {
        mmi_frm_hide_menu_item(menu_id);
        return;
    }
#endif
}

static void mmi_fmgr_to_phb_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8                      *filepath;
    srv_fmgr_fileinfo_struct info;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    filepath = (S8*)srv_fmgr_types_query_fileinfo(&info);
#ifdef __MMI_VCARD__
    if (info.type == FMGR_TYPE_VCF)
    {
    #ifdef __SYNCML_SUPPORT__
        if (mmi_syncml_is_phb_sync_now())
        {
            mmi_popup_display_simple((WCHAR*)GetString(STR_ID_SYNC_CODE_FORBIDDEN), MMI_EVENT_FAILURE, GRP_ID_ROOT, NULL);
            return;
        }
    #endif
        mmi_vcard_recv_from_file_mgr(filepath);
    }
    else
#endif
    {
        mmi_phb_fmgr_from_file_mgr(filepath);
    }
}

void mmi_fmgr_highlight_to_phb(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeyHandler(mmi_fmgr_to_phb_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_to_phb_hdlr, KEY_EVENT_UP);
#ifdef __MMI_TOUCH_SCREEN__
    wgui_register_list_item_selected_callback(mmi_fmgr_to_phb_hdlr);
#endif 
}

#ifdef __MMI_BG_SOUND_EFFECT__		
void mmi_fmgr_forward_bgsound_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (!FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_WAV) ||
        !fmgr_is_network_services_available()
#ifdef __FLIGHT_MODE_SUPPORT__
        || mmi_bootup_get_active_flight_mode() != 0
#endif 
        )
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_FWD_BGSOUND);
        return;
    }
}

static void mmi_fmgr_to_bgsound_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8                      *filepath;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    filepath = (S8*)srv_fmgr_types_query_fileinfo(NULL);
    mmi_bgsnd_fmgr_from_file_mgr(filepath, MMI_FALSE);
}

void mmi_fmgr_highlight_to_bgsound(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeyHandler(mmi_fmgr_to_bgsound_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_to_bgsound_hdlr, KEY_EVENT_UP);
#ifdef __MMI_TOUCH_SCREEN__
    wgui_register_list_item_selected_callback(mmi_fmgr_to_bgsound_hdlr);
#endif 
}
#endif


#if !defined (__MMI_MESSAGES_NO_SEND_BY_SMS_OPTION__)
void mmi_fmgr_forward_sms_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 app_id;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    if (srv_sms_is_hide_send_sms_menu_item())
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_FWD_SMS);
        return;
    }

    mmi_fmgr_get_current_fileinfo(NULL, &app_id);
    if (app_id == APP_DOWNLOADAGENT)
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_FWD_SMS);
        return;
    }
    
}

static void mmi_fmgr_to_sms_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8                      *filepath;
    srv_fmgr_fileinfo_struct info;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    filepath = (S8*)srv_fmgr_types_query_fileinfo(&info);

#ifdef __MMI_VCARD__
    if (info.type == FMGR_TYPE_VCF)
    {
        EntryNewScreen(SCR_ID_FMGR_FORWARD_DUMMY, NULL, NULL, NULL);
        mmi_vcard_fmgr_sms_forward(filepath);
        return;
    }
#endif
#ifdef __MMI_VCALENDAR__
    if (info.type == FMGR_TYPE_VCS)
    {
        EntryNewScreen(SCR_ID_FMGR_FORWARD_DUMMY, NULL, NULL, NULL);
        mmi_vcal_fmgr_sms_forward(filepath);
        return;
    }
#endif
#if defined (__MMI_VBOOKMARK__ ) && defined(__MMI_BRW_BOOKMARK_IN_FMGR__)
    if (info.type == FMGR_TYPE_URL || 
        info.type == FMGR_TYPE_VBM)
    {
        EntryNewScreen(SCR_ID_FMGR_FORWARD_DUMMY, NULL, NULL, NULL);
        mmi_vbkm_fmgr_sms_forward(filepath);
        return;
    }
#endif /* #if defined (__MMI_VBOOKMARK__ ) && defined(__MMI_BRW_BOOKMARK_IN_FMGR__) */
}

void mmi_fmgr_highlight_to_sms(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeyHandler(mmi_fmgr_to_sms_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_to_sms_hdlr, KEY_EVENT_UP);
#ifdef __MMI_TOUCH_SCREEN__
    wgui_register_list_item_selected_callback(mmi_fmgr_to_sms_hdlr);
#endif 
}
#endif

#ifdef __MMI_EMAIL__
void mmi_fmgr_forward_email_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 app_id;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if(!mmi_email_is_email_can_forward())
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_FWD_EMAIL);
        return;
    }

    mmi_fmgr_get_current_fileinfo(NULL, &app_id);
    if (app_id == APP_DOWNLOADAGENT)
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_FWD_EMAIL);
        return;
    }
}

static void mmi_fmgr_to_email_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    mmi_email_fmgr_send((S8*)srv_fmgr_types_query_fileinfo(NULL), MMI_FALSE);
}

void mmi_fmgr_highlight_to_email(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeyHandler(mmi_fmgr_to_email_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_to_email_hdlr, KEY_EVENT_UP);
#ifdef __MMI_TOUCH_SCREEN__
    wgui_register_list_item_selected_callback(mmi_fmgr_to_email_hdlr);
#endif 
}
#endif

void mmi_fmgr_forward_peripheral_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 app_id;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __MMI_BT_SUPPORT__
    if (MMI_FALSE||
    #if defined(__MMI_FMGR_MULTI_SELECT_SUPPORT__) && defined(__MMI_BT_SEND_SUPPORT__)
        (menu_id == MENU_ID_FMGR_MARK_OPTION_TO_BT) ||
    #endif /* __MMI_FMGR_MULTI_SELECT_SUPPORT__ */
        MMI_FALSE)
    {
        if (!mmi_bt_is_to_display_bt_menu())
        {
            mmi_frm_hide_menu_item(menu_id);
            return;
        }
    }
    else
#endif /* __MMI_BT_SUPPORT__ */
    {
    #ifdef __FLIGHT_MODE_SUPPORT__
        if( mmi_bootup_get_active_flight_mode())
        {
            mmi_frm_hide_menu_item(menu_id);
            return;
        }
    #endif /* __FLIGHT_MODE_SUPPORT__ */
    }
    
    mmi_fmgr_get_current_fileinfo(NULL, &app_id);
    if (app_id == APP_DOWNLOADAGENT)
    {
        mmi_frm_hide_menu_item(menu_id);
        return;
    }
}


#define FILE_HANDLER

void mmi_fmgr_option_img_print_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_fmgr_filetype_enum type;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    type = srv_fmgr_types_get_main_type(&(fileinfo->file_type));
    /* handle PRINT_PICTBRIDGE / PRINT_BLUETOOTH */

#if defined(__MMI_PICT_BRIDGE_SUPPORT__)
    /* PRINT_PICTBRIDGE 
     */
    if (!mmi_imgview_is_image_type_printable(type, MMI_IMGVIEW_PRINT_PICTBRIDGE))
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_PRINT_PICTBRIGE);
    }
#endif

#if defined(__MMI_BPP_SUPPORT__)
    /* PRINT_BLUETOOTH 
     *  only support when not in Flight mode
     */
    if (!mmi_bt_is_to_display_bt_menu() ||
        !mmi_imgview_is_image_type_printable(type, MMI_IMGVIEW_PRINT_BPP))
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_PRINT_BLUETOOTH);
    }    
#endif
    
}

void mmi_fmgr_option_img_print_enabler_ex(mmi_menu_id item_id, const WCHAR* filepath, const srv_fmgr_fileinfo_struct* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_fmgr_filetype_enum type;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/        
    type = fileinfo->type;
    /* handle PRINT_PICTBRIDGE / PRINT_BLUETOOTH */

#if defined(__MMI_PICT_BRIDGE_SUPPORT__)
    /* PRINT_PICTBRIDGE 
     */
    if (!mmi_imgview_is_image_type_printable(type, MMI_IMGVIEW_PRINT_PICTBRIDGE))
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_PRINT_PICTBRIGE);
    }
#endif

#if defined(__MMI_BPP_SUPPORT__)
    /* PRINT_BLUETOOTH 
     *  only support when not in Flight mode
     */
    if (!mmi_bt_is_to_display_bt_menu() ||
        !mmi_imgview_is_image_type_printable(type, MMI_IMGVIEW_PRINT_BPP))
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_PRINT_BLUETOOTH);
    }    
#endif

    mmi_fmgr_util_hide_menuid_for_2nd_card(MENU_ID_FMGR_IMG_OPTION_PRINT, (const S8*)filepath);    
}

/*****************************************************************************
 * FUNCTION
 *  mmi_fmgr_option_audio_enabler
 * DESCRIPTION
 *  
 * PARAMETERS
 *  menu_id         [IN]        
 *  fileinfo        [IN]        
 * RETURNS
 *  void
 *****************************************************************************/
void mmi_fmgr_option_audio_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#if defined(__MMI_RING_COMPOSER__) && defined(__MMI_IMELODY_SUPPORT__)
    if (!FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_IMY))
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_AUD_OPTION_EDIT);
    }
#endif /* defined(__MMI_RING_COMPOSER__) && defined(__MMI_IMELODY_SUPPORT__) */ 
}

void mmi_fmgr_option_audio_enabler_ex(mmi_menu_id item_id, const WCHAR* filepath, const srv_fmgr_fileinfo_struct* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_fmgr_util_hide_menuid_for_2nd_card(MENU_ID_FMGR_AUD_OPTION_PLAY, (const S8*)filepath);
#if defined(__MMI_RING_COMPOSER__) && defined(__MMI_IMELODY_SUPPORT__)
    if (fileinfo->type != FMGR_TYPE_IMY)
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_AUD_OPTION_EDIT);
    }

    mmi_fmgr_util_hide_menuid_for_2nd_card(MENU_ID_FMGR_AUD_OPTION_EDIT, (const S8*)filepath);
#endif /* defined(__MMI_RING_COMPOSER__) && defined(__MMI_IMELODY_SUPPORT__) */
}

void mmi_fmgr_option_image_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* handle PRINT/JPG_DETAIL/EDIT */
    
#ifdef __MMI_IMAGE_VIEWER_EX__
    if(FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_EMS) || FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_ANM))
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_IMG_OPTION_VIEW);
    }
#endif

#if defined(__MMI_BPP_SUPPORT__) || defined(__MMI_PICT_BRIDGE_SUPPORT__)
    /* PRINT 
     *  
     */
    mmi_frm_unhide_child_menu_items(MENU_ID_FMGR_IMG_OPTION_PRINT);
    mmi_fmgr_option_img_print_enabler(MENU_ID_FMGR_IMG_OPTION_PRINT, fileinfo);
    if(0 == GetNumOfChild_Ext(MENU_ID_FMGR_IMG_OPTION_PRINT))
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_IMG_OPTION_PRINT);
    }
#endif
}

void mmi_fmgr_option_image_enabler_ex(mmi_menu_id item_id, const WCHAR* filepath, const srv_fmgr_fileinfo_struct* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    BOOL    is_drm = FALSE;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* handle PRINT/JPG_DETAIL/EDIT */

    /* check DRM */
#ifdef __DRM_SUPPORT__
    if(DRM_METHOD_NONE != DRM_get_object_method(0, (kal_wchar*)mmi_fmgr_get_current_fileinfo(NULL, NULL)))
    {
        is_drm = TRUE;
    }
#endif
    
#ifdef __MMI_IMAGE_VIEWER_EX__
    if(fileinfo->type == FMGR_TYPE_EMS || fileinfo->type == FMGR_TYPE_ANM)
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_IMG_OPTION_VIEW);
    }    
#endif
	mmi_fmgr_util_hide_menuid_for_2nd_card(MENU_ID_FMGR_IMG_OPTION_VIEW, (const S8*)filepath);

    /* JPG_DETAIL 
     *  only support JPG files and when EXIF is defined.
     */
#if defined(__MMI_IMAGE_VIEWER__)
    mmi_fmgr_util_hide_menuid_for_2nd_card(MENU_ID_IMGVIEW_OPTION_IMG_INFORMATION, (const S8*)filepath);
#endif 

#if defined(__MMI_BPP_SUPPORT__) || defined(__MMI_PICT_BRIDGE_SUPPORT__)
    /* PRINT 
     *  
     */
    mmi_frm_unhide_child_menu_items(MENU_ID_FMGR_IMG_OPTION_PRINT);
    mmi_fmgr_option_img_print_enabler_ex(MENU_ID_FMGR_IMG_OPTION_PRINT, filepath, fileinfo);
    if(0 == GetNumOfChild_Ext(MENU_ID_FMGR_IMG_OPTION_PRINT))
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_IMG_OPTION_PRINT);
    }
#endif

#ifdef __MMI_PHOTOEDITOR__
    mmi_fmgr_util_hide_menuid_for_2nd_card(MENU_ID_FMGR_IMG_OPTION_EDIT, (const S8*)filepath);
#endif
}


void mmi_fmgr_option_mediaview_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    BOOL    is_drm = FALSE;
   
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* check DRM */
#ifdef __DRM_SUPPORT__
    if(DRM_METHOD_NONE != DRM_get_object_method(0, (kal_wchar*)mmi_fmgr_get_current_fileinfo(NULL, NULL)))
    {
        is_drm = TRUE;
    }
#endif
    
#ifdef __MMI_PHOTOEDITOR__
    /* EDIT 
     *  only support non-DRM JPG files
     */
    if(is_drm || (!FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_PNG)&&!FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_JPG) && !FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_JPEG)))
    {
        mmi_frm_hide_menu_item(MENU_ID_IMGVIEW_ENTRY_PHOTOEDITOR);
    }
#endif


    if(fileinfo->attribute & FS_ATTR_DIR)
    {
        mmi_frm_hide_menu_item(MENU_ID_IMGVIEW_VIEW_DETAIL);
    }
    else
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_FOLDER_OPEN);
    }
    mmi_frm_hide_menu_item(MENU_ID_FMGR_GEN_OPTION_DETAIL);

#if defined(__MMI_BPP_SUPPORT__) || defined(__MMI_PICT_BRIDGE_SUPPORT__)
    /* PRINT 
     *  
     */
    mmi_frm_unhide_child_menu_items(MENU_ID_FMGR_IMG_OPTION_PRINT);
    mmi_fmgr_option_img_print_enabler(MENU_ID_FMGR_IMG_OPTION_PRINT, fileinfo);
    if(0 == GetNumOfChild_Ext(MENU_ID_FMGR_IMG_OPTION_PRINT))
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_IMG_OPTION_PRINT);
    }
#endif
}


void mmi_fmgr_empty_option_imgviewer_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#ifdef __FS_CARD_SUPPORT__
    /* for 64+32 */
    if (SRV_FMGR_PUBLIC_DRV == SRV_FMGR_CARD_DRV)
    {
        mmi_frm_hide_menu_item(MENU_ID_IMGVIEW_STORAGE);
    }
#endif
}


void mmi_fmgr_option_imgviewer_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    BOOL    is_drm = FALSE;
   
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* check DRM */
#ifdef __DRM_SUPPORT__
    if(DRM_METHOD_NONE != DRM_get_object_method(0, (kal_wchar*)mmi_fmgr_get_current_fileinfo(NULL, NULL)))
    {
        is_drm = TRUE;
    }
#endif
    
#ifdef __MMI_PHOTOEDITOR__
    /* EDIT 
     *  only support non-DRM JPG files
     */
    if(is_drm || (!FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_PNG)&&!FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_JPG) && !FMGR_FILTER_IS_SET(&fileinfo->file_type, FMGR_TYPE_JPEG)))
    {
        mmi_frm_hide_menu_item(MENU_ID_IMGVIEW_ENTRY_PHOTOEDITOR);
    }
#endif


    if(fileinfo->attribute & FS_ATTR_DIR)
    {
        mmi_frm_hide_menu_item(MENU_ID_IMGVIEW_VIEW_DETAIL);
    }
    else
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_FOLDER_OPEN);
    }
    mmi_frm_hide_menu_item(MENU_ID_FMGR_GEN_OPTION_DETAIL);

#if defined(__MMI_BPP_SUPPORT__) || defined(__MMI_PICT_BRIDGE_SUPPORT__)
    /* PRINT 
     *  
     */
    mmi_frm_unhide_child_menu_items(MENU_ID_FMGR_IMG_OPTION_PRINT);
    mmi_fmgr_option_img_print_enabler(MENU_ID_FMGR_IMG_OPTION_PRINT, fileinfo);
    if(0 == GetNumOfChild_Ext(MENU_ID_FMGR_IMG_OPTION_PRINT))
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_IMG_OPTION_PRINT);
    }
#endif

#ifdef __FS_CARD_SUPPORT__
    /* for 64+32 */
    if (SRV_FMGR_PUBLIC_DRV == SRV_FMGR_CARD_DRV)
    {
        mmi_frm_hide_menu_item(MENU_ID_IMGVIEW_STORAGE);
    }
#endif
}

#ifdef __MMI_VIDEO_PLAYER__
void mmi_vdoply_file_option_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    U16 drive = SRV_FMGR_PUBLIC_DRV;
#if defined(__FS_CARD_SUPPORT__) && defined(__VDOREC_FEATURE_STORAGE__) 
        /* for 64+32 */
        if (drive == SRV_FMGR_CARD_DRV)
        {
            mmi_frm_hide_menu_item(MENU_ID_VDOPLY_STORAGE);
        }
#endif

}
void mmi_vdoply_empty_option_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    U16 drive = SRV_FMGR_PUBLIC_DRV;
#if defined(__FS_CARD_SUPPORT__) && defined(__VDOREC_FEATURE_STORAGE__) 
            /* for 64+32 */
            if (drive == SRV_FMGR_CARD_DRV)
            {
                mmi_frm_hide_menu_item(MENU_ID_VDOPLY_STORAGE);
            }
#endif
}

#endif
#if defined(OBIGO_Q05A)
void mmi_fmgr_option_bookmark_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    /* handle OPEN */
    
    if (!fmgr_is_network_services_available() ||
        mmi_bootup_get_active_flight_mode() )
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_BOOKMARK_FILE_OPEN);
    }  
}
#endif /* OBIGO_Q05A */

#if defined (__MMI_VBOOKMARK__ ) && defined(__MMI_BRW_BOOKMARK_IN_FMGR__)
void mmi_fmgr_option_vbookmark_enabler(U16 menu_id, const FMGR_FILE_INFO_STRUCT* fileinfo)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if (!fmgr_is_network_services_available() ||
        mmi_bootup_get_active_flight_mode() )
    {
        mmi_frm_hide_menu_item(MENU_ID_FMGR_VBOOKMARK_OPTION_GOTO);
        mmi_frm_hide_menu_item(MENU_ID_FMGR_VBOOKMARK_OPTION_OPEN);
    }
}
#endif /* #if defined (__MMI_VBOOKMARK__ ) && defined(__MMI_BRW_BOOKMARK_IN_FMGR__) */

/* Imgview CUI using start */
/*****************************************************************************
 * FUNCTION
 *  mmi_fmgr_image_view_group_proc
 * DESCRIPTION
 *  FMGR image view process
 * PARAMETERS
 *  evt      : [OUT] event pointer
 * RETURNS
 *  void
 *****************************************************************************/
mmi_ret mmi_fmgr_image_view_group_proc(mmi_event_struct* evt)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 testevt = EVT_ID_GROUP_ENTER;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    switch(evt->evt_id)
    {
        case EVT_ID_GROUP_ENTER:
        /* enter group ToDo1 */
            break;
        case EVT_ID_GROUP_ACTIVE:
        /* enter group ToDo2 */
            break;
        case EVT_ID_GROUP_FOCUSED:
        /* enter group ToDo3 */
            break;
        case EVT_ID_GROUP_GOBACK:
        /* gobackhistory ToDo1 */
            break;
        case EVT_ID_GROUP_INACTIVE:
        /* gobackhistory ToDo2 */
            break;
        case EVT_ID_GROUP_EXIT:
        /* gobackhistory ToDo3 */
            break;
        case EVT_ID_GROUP_DEINIT:
        /* gobackhistory ToDo4 */
            break;
        case EVT_ID_IMGVIEW_CLOSE_GID:
        /* closegroup ToDo1 */
        {
            mmi_group_event_struct *cui_evt;
            mmi_id parent_gid;
            cui_evt = (mmi_group_event_struct*)evt;
            parent_gid = mmi_frm_group_get_top_parent_group_id(cui_evt->sender_id);
            cui_imgview_close(cui_evt->sender_id);
            mmi_frm_group_close(parent_gid);
            break;
        }
        default:
            break;
    }
    return MMI_RET_OK;
}


/*****************************************************************************
 * FUNCTION
 *  mmi_fmgr_image_view_run_imgview_cui
 * DESCRIPTION
 *  Run image view CUI
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_fmgr_image_view_run_imgview_cui(PS8 file_path, U16 app_id, U16 string, U16 icon)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_id temp_parent_gid;
    mmi_id imgview_gid;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    temp_parent_gid = mmi_frm_group_create(GRP_ID_ROOT, GRP_ID_AUTO_GEN, mmi_fmgr_image_view_group_proc, NULL); 
    mmi_frm_group_enter(temp_parent_gid, MMI_FRM_NODE_SMART_CLOSE_FLAG);
    if ((imgview_gid = cui_imgview_create(temp_parent_gid)) != GRP_ID_INVALID)
    {
        cui_imgview_set_mode_filename(imgview_gid, file_path);
        cui_imgview_set_app_id(imgview_gid, app_id);
        cui_imgview_set_title(imgview_gid, NULL, icon);
        cui_imgview_set_ui_direction(imgview_gid, CUI_IMGVIEW_UI_DIRECTION_VERTICAL);
        cui_imgview_set_display_cap(imgview_gid, CUI_IMGVIEW_CAP_ALL, MMI_TRUE);
        cui_imgview_set_display_cap(imgview_gid, CUI_IMGVIEW_CAP_COUNTER, MMI_FALSE);   
        cui_imgview_set_display_cap(imgview_gid, CUI_IMGVIEW_CAP_SLIDESHOW, MMI_FALSE);   
        cui_imgview_set_display_cap(imgview_gid, CUI_IMGVIEW_CAP_TITLE, MMI_FALSE);   
        cui_imgview_set_display_cap(imgview_gid, CUI_IMGVIEW_CAP_DB, MMI_FALSE);   
        cui_imgview_run(imgview_gid);
    }
    else
    {
        mmi_frm_group_close(temp_parent_gid);
        /*TODO: add trace*/
    }
}
/* Imgview CUI using end */


/****************************************************************************
 *  Image
 */
static void mmi_fmgr_image_view_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    const WCHAR *filepath;
    srv_fmgr_fileinfo_struct info;
    U16                     icon_id;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    filepath = srv_fmgr_types_query_fileinfo(&info);
    mmi_fmgr_get_app_title_info(APP_IMAGEVIEWER, NULL, &icon_id, (S8*)filepath);
    mmi_fmgr_image_view_run_imgview_cui((S8*)filepath, APP_IMAGEVIEWER, NULL, icon_id);
    return;
}

void mmi_fmgr_highlight_image_view(void)
{
    SetKeyHandler(mmi_fmgr_image_view_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_image_view_hdlr, KEY_EVENT_UP);
#ifdef __MMI_TOUCH_SCREEN__
    wgui_register_list_item_selected_callback(mmi_fmgr_image_view_hdlr);
#endif 
}

#ifdef __MMI_PHOTOEDITOR__
static void mmi_fmgr_image_edit_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    mmi_phoart_entry_from_fmgr((S8*)srv_fmgr_types_query_fileinfo(NULL), MMI_FALSE);
}

void mmi_fmgr_highlight_image_edit(void)
{
    SetKeyHandler(mmi_fmgr_image_edit_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_image_edit_hdlr, KEY_EVENT_UP);
#ifdef __MMI_TOUCH_SCREEN__
    wgui_register_list_item_selected_callback(mmi_fmgr_image_edit_hdlr);
#endif 
}
#endif /* __MMI_PHOTOEDITOR__ */

#if defined(__MMI_PICT_BRIDGE_SUPPORT__) || defined(__MMI_BPP_SUPPORT__)

static S8* g_fmgr_image_print_filepath = NULL;
static U16 g_fmgr_image_print_icon_id = 0;

static void mmi_fmgr_image_exit_print_option(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    extern void mmi_fmgr_image_entry_print_option(void);
    history currHistory;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    /* When exit, copy filepath into inputBuffer */
    if(!CheckIsBackHistory())
    {
        ASSERT(g_fmgr_image_print_filepath);
        currHistory.scrnID = SCR_FMGR_PRINT_OPTION;
        mmi_ucs2cpy((S8*)currHistory.inputBuffer+2, g_fmgr_image_print_filepath);
        *((U16*)currHistory.inputBuffer) = g_fmgr_image_print_icon_id+1;
        currHistory.entryFuncPtr = mmi_fmgr_image_entry_print_option;
        GetCategoryHistory(currHistory.guiBuffer);
        AddHistory(currHistory);
    }
    OslMfree(g_fmgr_image_print_filepath);
    g_fmgr_image_print_filepath = NULL;
}

static void mmi_fmgr_image_entry_print_option(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    FMGR_FILE_INFO_STRUCT   file_info;
    S8                      *filepath;
    U16                     icon_id;
    FS_HANDLE               handle;

    U16                     nNumofItem;
    U8                      *guiBuffer;
    U16                     nStrItemList[20];
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    if(CheckIsBackHistory())
    {
        /* load filepath from input buffer */
        ASSERT(!g_fmgr_image_print_filepath);
        g_fmgr_image_print_filepath = OslMalloc((mmi_ucs2strlen((S8*)GetCurrInputBuffer(SCR_FMGR_PRINT_OPTION))+1)*2);
        mmi_ucs2cpy(g_fmgr_image_print_filepath, (S8*)GetCurrInputBuffer(SCR_FMGR_PRINT_OPTION)+2);
        g_fmgr_image_print_icon_id = (U16)(*((U16*)GetCurrInputBuffer(SCR_FMGR_PRINT_OPTION)) - 1);
    }
    else
    {
        ASSERT(g_fmgr_image_print_filepath);
    }
    
    filepath = g_fmgr_image_print_filepath;
    icon_id = g_fmgr_image_print_icon_id;
    handle = mmi_fmgr_get_file_info_by_path(filepath, &file_info);
    if(handle < 0)
    {
        /* FS error */
        mmi_popup_display_simple((WCHAR*)GetString(srv_fmgr_fs_error_get_string(handle)), MMI_EVENT_FAILURE, GRP_ID_ROOT, NULL);
        goto print_error;
    }

#ifdef __DRM_SUPPORT__
    if(!_fmgr_check_drm_rights(filepath, DRM_PERMISSION_PRINT, icon_id))
    {
        goto print_error;
    }
#endif /* __DRM_SUPPORT__ */ 

    /* enabler logic */
    mmi_frm_unhide_child_menu_items(MENU_ID_FMGR_IMG_OPTION_PRINT);
    mmi_fmgr_option_img_print_enabler(MENU_ID_FMGR_IMG_OPTION_PRINT, &file_info);
    nNumofItem = GetNumOfChild_Ext(MENU_ID_FMGR_IMG_OPTION_PRINT);
    if (nNumofItem == 0)
    {
        mmi_popup_display_simple((WCHAR*)GetString(STR_GLOBAL_UNSUPPORTED_FORMAT), MMI_EVENT_FAILURE, GRP_ID_ROOT, NULL);
        goto print_error;
    }

    EntryNewScreen(SCR_FMGR_PRINT_OPTION, mmi_fmgr_image_exit_print_option, NULL, NULL);

    guiBuffer = GetCurrGuiBuffer(SCR_FMGR_PRINT_OPTION);

    SetParentHandler(MENU_ID_FMGR_IMG_OPTION_PRINT);
    RegisterHighlightHandler(ExecuteCurrHiliteHandler);

    GetSequenceStringIds_Ext(MENU_ID_FMGR_IMG_OPTION_PRINT, nStrItemList);

    ShowCategory15Screen(
        STR_GLOBAL_PRINT,
        icon_id,
        STR_GLOBAL_OK,
        IMG_GLOBAL_OK,
        STR_GLOBAL_BACK,
        IMG_GLOBAL_BACK,
        nNumofItem,
        nStrItemList,
        (U16*) gIndexIconsImageList,
        1,
        0,
        guiBuffer);

    SetRightSoftkeyFunction(GoBackHistory, KEY_EVENT_UP);
    SetKeyHandler(GoBackHistory, KEY_LEFT_ARROW, KEY_EVENT_DOWN);
    return;

print_error:
    if(g_fmgr_image_print_filepath)
    {
        OslMfree(g_fmgr_image_print_filepath);
        g_fmgr_image_print_filepath = NULL;
    }
}

void mmi_fmgr_image_print_by_imgviewer(S8* filepath, U16 icon_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    // Copy string
    ASSERT(!g_fmgr_image_print_filepath);
    g_fmgr_image_print_filepath = OslMalloc((mmi_ucs2strlen(filepath)+1)*2);
    mmi_ucs2cpy(g_fmgr_image_print_filepath, filepath);

    g_fmgr_image_print_icon_id = icon_id;

    mmi_fmgr_image_entry_print_option();
}

#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#endif

void mmi_fmgr_highlight_image_print(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
#if 0
/* under construction !*/
/* under construction !*/
#ifdef __MMI_TOUCH_SCREEN__
/* under construction !*/
#endif
#endif
}

#ifdef __MMI_PICT_BRIDGE_SUPPORT__
static void mmi_fmgr_image_print_to_pictbridge(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    SRV_FMGR_FILEINFO_HANDLE fileinfo_hdl;
    srv_fmgr_fileinfo_struct file_info;
    cui_pict_file_info_struct pict_info;
    S8 *filepath;
    S32 fs_ret;
    mmi_id grp_id;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    filepath = (S8*)OslMalloc((SRV_FMGR_PATH_MAX_LEN + 1) * ENCODING_LENGTH);
    memset(filepath, 0, ((SRV_FMGR_PATH_MAX_LEN + 1) * ENCODING_LENGTH));
    if(g_fmgr_image_print_filepath)
        mmi_ucs2cpy(filepath, g_fmgr_image_print_filepath);
    else
        mmi_ucs2cpy(filepath, (S8*)srv_fmgr_types_query_fileinfo(NULL));
 
    fs_ret = srv_fmgr_fileinfo_create((WCHAR *)filepath, &fileinfo_hdl);
    if (fs_ret < 0)
    {
        MMI_ASSERT(0);
    }

    srv_fmgr_fileinfo_get_info(fileinfo_hdl, &file_info);
    srv_fmgr_fileinfo_destroy(fileinfo_hdl);

    grp_id = mmi_frm_group_create(GRP_ID_ROOT, GRP_ID_AUTO_GEN, mmi_dummy_proc, NULL);
    mmi_frm_group_enter(grp_id, MMI_FRM_NODE_SMART_CLOSE_FLAG);

    pict_info.full_path = (WCHAR *)filepath;
    pict_info.index = 0;
    pict_info.info = &file_info;
    cui_pict_print_launch(grp_id, MMI_FALSE, 1, &pict_info);
    
    OslMfree(filepath);
    DeleteScreenIfPresent(SCR_FMGR_PRINT_OPTION);
}

void mmi_fmgr_highlight_image_print_to_pictbridge(void)
{
    SetLeftSoftkeyFunction(mmi_fmgr_image_print_to_pictbridge, KEY_EVENT_UP);
}
#endif

#ifdef __MMI_BPP_SUPPORT__
static void mmi_fmgr_image_print_to_bluetooth(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8                      *filepath;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    
    if(g_fmgr_image_print_filepath)
        filepath = g_fmgr_image_print_filepath;
    else
        filepath = (S8*)srv_fmgr_types_query_fileinfo(NULL);

    mmi_imgview_bpp_print_file (filepath, MMI_FALSE);
    
    DeleteScreenIfPresent(SCR_FMGR_PRINT_OPTION);
}

void mmi_fmgr_highlight_image_print_to_bluetooth(void)
{
    SetLeftSoftkeyFunction(mmi_fmgr_image_print_to_bluetooth, KEY_EVENT_UP);
}
#endif

#endif /* defined(__MMI_PICT_BRIDGE_SUPPORT__) || defined(__MMI_BPP_SUPPORT__) */

/****************************************************************************
 *  Audio
 */
static void mmi_fmgr_audio_play_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8                      *filepath;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    filepath = (S8*)srv_fmgr_types_query_fileinfo(NULL);

#ifdef __DRM_SUPPORT__
    if(!_fmgr_check_drm_rights(filepath, DRM_PERMISSION_PLAY, 0))
    {
        return;
    }
#endif

    mmi_media_app_play_audio(filepath, NULL, 0);
}

void mmi_fmgr_highlight_audio_play(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeyHandler(mmi_fmgr_audio_play_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_audio_play_hdlr, KEY_EVENT_UP);
#ifdef __MMI_TOUCH_SCREEN__
    wgui_register_list_item_selected_callback(mmi_fmgr_audio_play_hdlr);
#endif 
}


/*****************************************************************************
 * FUNCTION
 *  mmi_fmgr_audio_edit_hdlr
 * DESCRIPTION
 *  
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_fmgr_audio_edit_hdlr(void)
{
#if defined(__MMI_RING_COMPOSER__) && defined(__MMI_IMELODY_SUPPORT__)
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8                      *filepath;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    filepath = (S8*)srv_fmgr_types_query_fileinfo(NULL);

    mmi_rngc_fmgr_edit_imy((S8*)srv_fmgr_path_get_filename_ptr((WCHAR*)filepath), filepath);

#ifdef __DRM_SUPPORT__
    if (DRM_METHOD_NONE != DRM_get_object_method(0, (PU16)filepath))
    {
        mmi_popup_display_simple((WCHAR*)GetString(STR_GLOBAL_DRM_PROHIBITED), MMI_EVENT_FAILURE, GRP_ID_ROOT, NULL);
        return;
    }
#endif
#endif    
}

void mmi_fmgr_highlight_audio_edit(void)
{
#if defined(__MMI_RING_COMPOSER__) && defined(__MMI_IMELODY_SUPPORT__)
    SetKeyHandler(mmi_fmgr_audio_edit_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_audio_edit_hdlr, KEY_EVENT_UP);
#else /* defined(__MMI_RING_COMPOSER__) && defined(__MMI_IMELODY_SUPPORT__) */ 
    ASSERT(0);    
#endif /* defined(__MMI_RING_COMPOSER__) && defined(__MMI_IMELODY_SUPPORT__) */ 
}

/****************************************************************************
 *  Video
 */
#if defined(__MMI_VIDEO_PLAYER__) || defined(__MMI_MEDIA_PLAYER_VIDEO__) || defined (__MMI_ULC_VIDEO_PLAYER__)
static void mmi_fmgr_video_play_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    srv_fmgr_fileinfo_struct info;
    S8                      *filepath;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

#ifdef __MMI_DSM_NEW__
	if(MR_SUCCESS == mr_app_system_event_hdlr(MR_SYSMSG_LAUNCH_VDOPLY, (uint32)mmi_fmgr_video_play_hdlr, 0))
		return;
#endif

    filepath = (S8*)srv_fmgr_types_query_fileinfo(&info);

#ifdef __DRM_SUPPORT__
    if(!_fmgr_check_drm_rights(filepath, DRM_PERMISSION_PLAY, 0))
    {
        return;
    }
#endif

#ifdef __MMI_VIDEO_STREAM__
    if (info.type == FMGR_TYPE_SDP)
    {
        mmi_media_app_play_stream_from_sdp_file(filepath, MMI_FALSE);
    }
    else if (info.type == FMGR_TYPE_RAM)
    {
        mmi_media_app_play_stream_from_ram_file(filepath, MMI_FALSE);
    }
    else /* other video type */
    {
        mmi_media_app_play_video(filepath, MMI_FALSE);
    }
#else

    mmi_media_app_play_video(filepath, MMI_FALSE);

#endif /* __MMI_VIDEO_STREAM__ */  

}

void mmi_fmgr_highlight_video_play(void)
{
    SetKeyHandler(mmi_fmgr_video_play_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_video_play_hdlr, KEY_EVENT_UP);
#ifdef __MMI_TOUCH_SCREEN__
    wgui_register_list_item_selected_callback(mmi_fmgr_video_play_hdlr);
#endif 
}
#endif /* __MMI_VIDEO_PLAYER__ */

#ifdef __J2ME__
/****************************************************************************
 *  Java
 */
static void mmi_fmgr_java_execute_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S8                      *filepath;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    filepath = (S8*)srv_fmgr_types_query_fileinfo(NULL);

#ifdef __DRM_SUPPORT__
    if(!_fmgr_check_drm_rights(filepath, DRM_PERMISSION_EXECUTE, 0))
    {
        return;
    }
#endif 

    mmi_java_local_install_content_routing((kal_uint16*) filepath);

}

void mmi_fmgr_highlight_java_execute(void)
{
    SetKeyHandler(mmi_fmgr_java_execute_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_java_execute_hdlr, KEY_EVENT_UP);
#ifdef __MMI_TOUCH_SCREEN__
    wgui_register_list_item_selected_callback(mmi_fmgr_java_execute_hdlr);
#endif 
}
#if 0
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#ifdef __MMI_TOUCH_SCREEN__
/* under construction !*/
#endif 
/* under construction !*/
#endif    
#endif    

#ifdef __MMI_DOWNLOADABLE_THEMES_SUPPORT__
/****************************************************************************
 *  Downloadable Theme
 */

void mmi_fmgr_highlight_theme_activate(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeyHandler(mmi_fmgr_theme_activate_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_theme_activate_hdlr, KEY_EVENT_UP);
}
#endif /* __MMI_DOWNLOADABLE_THEMES_SUPPORT__ */

#if defined(OBIGO_Q05A)
/****************************************************************************
 *  Bookmark
 */
/*****************************************************************************
 * FUNCTION
 *  fmgr_goto_bookmark_hdlr
 * DESCRIPTION
 *  Open book
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_fmgr_bookmark_goto_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    mmi_brw_open_file_from_fmgr((S8*)srv_fmgr_types_query_fileinfo(NULL), MMI_FALSE);
}

void mmi_fmgr_highlight_bookmark_goto(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    SetKeyHandler(mmi_fmgr_bookmark_goto_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_bookmark_goto_hdlr, KEY_EVENT_UP);
}

#endif /* (OBIGO_Q05A) */

#if defined (__MMI_VBOOKMARK__ ) && defined(__MMI_BRW_BOOKMARK_IN_FMGR__)
/*****************************************************************************
 * FUNCTION
 *  fmgr_vbookmark_goto_hdlr
 * DESCRIPTION
 *  Open book
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_fmgr_vbookmark_goto_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    mmi_brw_bookmarks_goto_from_fmgr((S8*)srv_fmgr_types_query_fileinfo(NULL), MMI_FALSE);
}

/*****************************************************************************
 * FUNCTION
 *  fmgr_vbookmark_open_hdlr
 * DESCRIPTION
 *  Open book
 * PARAMETERS
 *  void
 * RETURNS
 *  void
 *****************************************************************************/
static void mmi_fmgr_vbookmark_open_hdlr(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    mmi_brw_bookmarks_open_from_fmgr((S8*)srv_fmgr_types_query_fileinfo(NULL), MMI_FALSE);
}

void mmi_fmgr_highlight_vbookmark_goto(void)
{
    SetKeyHandler(mmi_fmgr_vbookmark_goto_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_vbookmark_goto_hdlr, KEY_EVENT_UP);
}

void mmi_fmgr_highlight_vbookmark_open(void)
{
    SetKeyHandler(mmi_fmgr_vbookmark_open_hdlr, KEY_RIGHT_ARROW, KEY_EVENT_DOWN);
    SetLeftSoftkeyFunction(mmi_fmgr_vbookmark_open_hdlr, KEY_EVENT_UP);
}
#endif /* #if defined (__MMI_VBOOKMARK__ ) && defined(__MMI_BRW_BOOKMARK_IN_FMGR__) */


void mmi_fmgri_service_hdlr_init(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

#ifdef __DM_LAWMO_SUPPORT__
    mmi_dmui_lawmo_register_notify(MMI_DMUI_APP_ID_FMGR, MMI_DMUI_MO_TYPE_LAWMO_WIPE, fmgr_dm_lawmo_hdlr);
#endif
}

#define NOTIFY_HANDLER


#define HYPERLINK_HANDLER

#ifdef __MMI_MY_FAVORITE_IMAGES_HYPERLINK__
MMI_BOOL mmi_images_hyperlink_callback(U16 app_id, S8* path, fmgr_hyperlink_action_enum action, S32 para, S32* result)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_fmgr_hyperlink_info_struct *info;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ASSERT(app_id == APP_MYFAVORITE);

    switch (action)
    {
        case FMGR_HYPERLINK_GET_COUNT:
            /* only show hyperlink when: 1: has network service. 2: not in flight mode. 3: the path is on phone */
            if (fmgr_is_network_services_available() == MMI_TRUE && mmi_bootup_get_active_flight_mode() == 0 && path[0] == SRV_FMGR_PUBLIC_DRV)
            {
            #ifndef __MMI_MY_FAVORITE_IMGVIEW_HYPERLINK__
                *result = 1;
            #else /* __MMI_MY_FAVORITE_IMGVIEW_HYPERLINK__ */
                *result = 2;
            #endif /* __MMI_MY_FAVORITE_IMGVIEW_HYPERLINK__ */
            }
            else
            {
            #ifndef __MMI_MY_FAVORITE_IMGVIEW_HYPERLINK__
                *result = 0;
            #else /* __MMI_MY_FAVORITE_IMGVIEW_HYPERLINK__ */
                *result = 1;
            #endif /* __MMI_MY_FAVORITE_IMGVIEW_HYPERLINK__ */
            }
            break;
        
        case FMGR_HYPERLINK_GET_INFO:
            
            if (para == 0)
            {
				if (fmgr_is_network_services_available() == MMI_TRUE && mmi_bootup_get_active_flight_mode() == 0 && path[0] == SRV_FMGR_PUBLIC_DRV)
				{
					info = (mmi_fmgr_hyperlink_info_struct*)result;
					info->small_icon_id = IMG_ID_MY_FAVORITE_WAP_IMAGES;
					info->large_icon_id = IMG_ID_MY_FAVORITE_WAP_IMAGES_LARGE;
					info->string_ptr = (S8*)GetString(STR_ID_MY_FAVORITE_WAP_IMAGES);
					info->lsk_string_id = STR_GLOBAL_OPEN;
					info->lsk_handler = mmi_my_favorite_open_images_wap_hdlr;
				}
				else
				{
				#ifdef __MMI_MY_FAVORITE_IMGVIEW_HYPERLINK__
					info = (mmi_fmgr_hyperlink_info_struct*)result;
					info->small_icon_id = IMG_ID_MY_FAVORITE_WAP_IMGVIEW;
					info->large_icon_id = IMG_ID_MY_FAVORITE_WAP_IMGVIEW_LARGE;
					info->string_ptr = (S8*)GetString(STR_ID_IMGVIEW_NAME);
					info->lsk_string_id = STR_GLOBAL_OPEN;
					info->lsk_handler = mmi_imgview_launch;
				#else					
					return MMI_FALSE;
				#endif
				}                               
            }
        #ifdef __MMI_MY_FAVORITE_IMGVIEW_HYPERLINK__
            else if (para == 1)
            {
                info = (mmi_fmgr_hyperlink_info_struct*)result;
                info->small_icon_id = IMG_ID_MY_FAVORITE_WAP_IMGVIEW;
                info->large_icon_id = IMG_ID_MY_FAVORITE_WAP_IMGVIEW_LARGE;
                info->string_ptr = (S8*)GetString(STR_ID_IMGVIEW_NAME);
                info->lsk_string_id = STR_GLOBAL_OPEN;
                info->lsk_handler = mmi_imgview_launch;
            }
        #endif /* __MMI_MY_FAVORITE_IMGVIEW_HYPERLINK__ */
            else
            {
                return MMI_FALSE;
            }
            break;
    }
    return MMI_TRUE;
}
#endif /* __MMI_MY_FAVORITE_IMAGES_HYPERLINK__ */

#if defined(__MMI_MY_FAVORITE_AUDIO_HYPERLINK__)
MMI_BOOL mmi_audio_hyperlink_callback(U16 app_id, S8* path, fmgr_hyperlink_action_enum action, S32 para, S32* result)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_fmgr_hyperlink_info_struct *info;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ASSERT(app_id == APP_MYFAVORITE);

    switch(action)
    {
    case FMGR_HYPERLINK_GET_COUNT:
        /* only show hyperlink when:
         *  1: has network service and
         *  2: not in flight mode and
         *  3: the path is on phone
         */
        if (fmgr_is_network_services_available() == TRUE && mmi_bootup_get_active_flight_mode() == 0 && path[0] == SRV_FMGR_PUBLIC_DRV)
            *result = 1;
        else
            *result = 0;
        break;
        
    case FMGR_HYPERLINK_GET_INFO:
        if(para < 0 || para > 1)
            return FALSE;
        if (fmgr_is_network_services_available() != TRUE && mmi_bootup_get_active_flight_mode() != 0)
            return FALSE;
        
        info = (mmi_fmgr_hyperlink_info_struct*)result;
        info->small_icon_id = IMG_ID_MY_FAVORITE_WAP_AUDIO;
        info->large_icon_id = IMG_ID_MY_FAVORITE_WAP_AUDIO_LARGE;
        info->string_ptr = (S8*)GetString(STR_ID_MY_FAVORITE_WAP_AUDIO);
        info->lsk_string_id = STR_GLOBAL_OPEN;
        info->lsk_handler = mmi_my_favorite_open_audio_wap_hdlr;
        break;
    }
    return TRUE;
}
#endif

#if defined(__MMI_MY_FAVORITE_VIDEO_HYPERLINK__)
MMI_BOOL mmi_video_hyperlink_callback(U16 app_id, S8* path, fmgr_hyperlink_action_enum action, S32 para, S32* result)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_fmgr_hyperlink_info_struct *info;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ASSERT(app_id == APP_MYFAVORITE);

    switch(action)
    {
    case FMGR_HYPERLINK_GET_COUNT:
        /* only show hyperlink when:
         *  1: has network service and
         *  2: not in flight mode and
         *  3: the path is on phone
         */
        if (fmgr_is_network_services_available() == TRUE && mmi_bootup_get_active_flight_mode() == 0 && path[0] == SRV_FMGR_PUBLIC_DRV)
            *result = 1;
        else
            *result = 0;
        break;
        
    case FMGR_HYPERLINK_GET_INFO:
        if(para < 0 || para > 1)
            return FALSE;
        if (fmgr_is_network_services_available() != TRUE && mmi_bootup_get_active_flight_mode() != 0)
            return FALSE;
        
        info = (mmi_fmgr_hyperlink_info_struct*)result;
        info->small_icon_id = IMG_ID_MY_FAVORITE_WAP_VIDEO;
        info->large_icon_id = IMG_ID_MY_FAVORITE_WAP_VIDEO_LARGE;
        info->string_ptr = (S8*)GetString(STR_ID_MY_FAVORITE_WAP_VIDEO);
        info->lsk_string_id = STR_GLOBAL_OPEN;
        info->lsk_handler = mmi_my_favorite_open_video_wap_hdlr;
        break;
    }
    return TRUE;
}
#endif

#if defined(__MMI_MY_FAVORITE_MMSBOX_HYPERLINK__)
MMI_BOOL mmi_mmsbox_hyperlink_callback(U16 app_id, S8* path, fmgr_hyperlink_action_enum action, S32 para, S32* result)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_fmgr_hyperlink_info_struct *info;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ASSERT(app_id == APP_MYFAVORITE);

    switch(action)
    {
    case FMGR_HYPERLINK_GET_COUNT:
        /* only show hyperlink when:
         *  1: has network service and
         *  2: not in flight mode and
         *  3: the path is on phone
         */
        if (fmgr_is_network_services_available() == TRUE && mmi_bootup_get_active_flight_mode() == 0 && path[0] == SRV_FMGR_PUBLIC_DRV)
            *result = 1;
        else
            *result = 0;
        break;
        
    case FMGR_HYPERLINK_GET_INFO:
        if(para < 0 || para > 1)
            return FALSE;
        if (fmgr_is_network_services_available() != TRUE && mmi_bootup_get_active_flight_mode() != 0)
            return FALSE;
        
        info = (mmi_fmgr_hyperlink_info_struct*)result;
        info->small_icon_id = IMG_ID_MY_FAVORITE_WAP_MMSBOX;
        info->large_icon_id = IMG_ID_MY_FAVORITE_WAP_MMSBOX_LARGE;
        info->string_ptr = (S8*)GetString(STR_ID_MY_FAVORITE_WAP_MMSBOX);
        info->lsk_string_id = STR_GLOBAL_OPEN;
        info->lsk_handler = mmi_my_favorite_open_mmsbox_wap_hdlr;
        break;
    }
    return TRUE;
}
#endif

#if defined(__MMI_MY_FAVORITE_SWFLASH_HYPERLINK__)
MMI_BOOL mmi_swflash_hyperlink_callback(U16 app_id, S8* path, fmgr_hyperlink_action_enum action, S32 para, S32* result)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_fmgr_hyperlink_info_struct *info;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ASSERT(app_id == APP_MYFAVORITE);

    switch(action)
    {
    case FMGR_HYPERLINK_GET_COUNT:
        /* only show hyperlink when:
         *  1: has network service and
         *  2: not in flight mode and
         *  3: the path is on phone
         */
        if (fmgr_is_network_services_available() == TRUE && mmi_bootup_get_active_flight_mode() == 0 && path[0] == SRV_FMGR_PUBLIC_DRV)
            *result = 1;
        else
            *result = 0;
        break;
        
    case FMGR_HYPERLINK_GET_INFO:
        if(para < 0 || para > 1)
            return FALSE;
        if (fmgr_is_network_services_available() != TRUE && mmi_bootup_get_active_flight_mode() != 0)
            return FALSE;
        
        info = (mmi_fmgr_hyperlink_info_struct*)result;
        info->small_icon_id = IMG_ID_MY_FAVORITE_WAP_SWFLASH;
        info->large_icon_id = IMG_ID_MY_FAVORITE_WAP_SWFLASH_LARGE;
        info->string_ptr = (S8*)GetString(STR_ID_MY_FAVORITE_WAP_SWFLASH);
        info->lsk_string_id = STR_GLOBAL_OPEN;
        info->lsk_handler = mmi_my_favorite_open_swflash_wap_hdlr;
        break;
    }
    return TRUE;
}
#endif

#if defined(__MMI_MY_FAVORITE_THEME_HYPERLINK__)
MMI_BOOL mmi_theme_hyperlink_callback(U16 app_id, S8* path, fmgr_hyperlink_action_enum action, S32 para, S32* result)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_fmgr_hyperlink_info_struct *info;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ASSERT(app_id == APP_MYFAVORITE);

    switch(action)
    {
    case FMGR_HYPERLINK_GET_COUNT:
        /* only show hyperlink when:
         *  1: has network service and
         *  2: not in flight mode and
         *  3: the path is on phone
         */
        if (fmgr_is_network_services_available() == TRUE && mmi_bootup_get_active_flight_mode() == 0 && path[0] == SRV_FMGR_PUBLIC_DRV)
            *result = 1;
        else
            *result = 0;
        break;
        
    case FMGR_HYPERLINK_GET_INFO:
        if(para < 0 || para > 1)
            return FALSE;
        if (fmgr_is_network_services_available() != TRUE && mmi_bootup_get_active_flight_mode() != 0)
            return FALSE;
        
        info = (mmi_fmgr_hyperlink_info_struct*)result;
        info->small_icon_id = IMG_ID_MY_FAVORITE_WAP_THEME;
        info->large_icon_id = IMG_ID_MY_FAVORITE_WAP_THEME_LARGE;
        info->string_ptr = (S8*)GetString(STR_ID_MY_FAVORITE_WAP_THEME);
        info->lsk_string_id = STR_GLOBAL_OPEN;
        info->lsk_handler = mmi_my_favorite_open_theme_wap_hdlr;
        break;
    }
    return TRUE;
}
#endif

#if defined(__MMI_MY_FAVORITE_OTHERS_HYPERLINK__)
MMI_BOOL mmi_others_hyperlink_callback(U16 app_id, S8* path, fmgr_hyperlink_action_enum action, S32 para, S32* result)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_fmgr_hyperlink_info_struct *info;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ASSERT(app_id == APP_MYFAVORITE);

    switch(action)
    {
    case FMGR_HYPERLINK_GET_COUNT:
        /* only show hyperlink when:
         *  1: has network service and
         *  2: not in flight mode and
         *  3: the path is on phone
         */
        if (fmgr_is_network_services_available() == TRUE && mmi_bootup_get_active_flight_mode() == 0 && path[0] == SRV_FMGR_PUBLIC_DRV)
            *result = 1;
        else
            *result = 0;
        break;
        
    case FMGR_HYPERLINK_GET_INFO:
        if(para < 0 || para > 1)
            return FALSE;
        if (fmgr_is_network_services_available() != TRUE && mmi_bootup_get_active_flight_mode() != 0)
            return FALSE;
        
        info = (mmi_fmgr_hyperlink_info_struct*)result;
        info->small_icon_id = IMG_ID_MY_FAVORITE_WAP_OTHERS;
        info->large_icon_id = IMG_ID_MY_FAVORITE_WAP_OTHERS_LARGE;
        info->string_ptr = (S8*)GetString(STR_ID_MY_FAVORITE_WAP_OTHERS);
        info->lsk_string_id = STR_GLOBAL_OPEN;
        info->lsk_handler = mmi_my_favorite_open_others_wap_hdlr;
        break;
    }
    return TRUE;
}
#endif


#if defined(__MMI_JAVA_FMGR_HYPERLINK__)
MMI_BOOL mmi_java_fmgr_hyperlink_callback(U16 app_id, S8* path, fmgr_hyperlink_action_enum action, S32 para, S32* result)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_fmgr_hyperlink_info_struct *info;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    ASSERT(app_id == APP_FILEMANAGER);

    switch(action)
    {
        case FMGR_HYPERLINK_PREPARE:
            mmi_java_prepare_hyperlink_sub_title(path);
            break;

        case FMGR_HYPERLINK_GET_COUNT:
            *result = 1; /* One hyperlink */
            break;
            
        case FMGR_HYPERLINK_GET_INFO:        
            info = (mmi_fmgr_hyperlink_info_struct*)result;
            info->small_icon_id = IMG_MENU3108_JAVA;
            info->large_icon_id = IMG_ID_FMGR_FILE_TYPE_JAVA;
            info->string_ptr = (S8*)GetString(STR_SCR_JAVA_GAMES);
            info->sub_string_ptr = mmi_java_get_hyperlink_sub_title(path);
            info->lsk_string_id = STR_GLOBAL_OPEN;
            info->lsk_handler = mmi_java_entry_mids_list_screen;
            break;
    }
    return TRUE;
}
#endif /* __MMI_JAVA_FMGR_HYPERLINK__ */

#endif // defined (__MMI_FILE_MANAGER__)


#define FILE_LIMIT_API

#define FILE_LIMIT_ERROR_STR_LEN    (100)
#define FILE_LIMIT_ERROR_BUF_SIZE   ((FILE_LIMIT_ERROR_STR_LEN+1)*ENCODING_LENGTH)


U16 mmi_fmgr_util_file_limit_check2(const S32 *array_ptr, PS8 filename, S32 *errorno_p)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U32         file_size;
    S32         image_width, image_height, result;
    U16         res_group_type;
    FS_HANDLE   fs_handle;

    S32         *check_start_ptr;
    U16         resource_type = 0;
    S16         jump = 0;    

    S32         check_file_size, check_image_width, check_image_height;
    
    S32         errcode;
    U16         errstr;

#ifdef __MMI_VIDEO_PLAY_SUPPORT__
    mmi_event_notify_enum event_id;
    S32         check_duration;
    PS8         ext_ptr;
    mdi_video_info_struct vdo_info;
#endif 

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    check_start_ptr = (PS32) array_ptr;

    errcode = 0;
    errstr = 0;

    if (filename == NULL)
    {
        errcode = FS_INVALID_FILENAME;
        goto final;
    }

    fs_handle = DRM_open_file((PU16) filename, FS_READ_ONLY, DRM_PERMISSION_DISPLAY);

    if (fs_handle < 0)
    {
        errcode = fs_handle;
        goto final;
    }

    DRM_close_file(fs_handle);

    /* source from file */
    res_group_type = srv_fmgr_types_find_group_by_filename_str((WCHAR*)(filename));

    if (res_group_type == FMGR_GROUP_IMAGE)
    {
        /* images */
        jump = 4;
        resource_type = gdi_image_get_type_from_file(filename);

    }
    else if (res_group_type == FMGR_GROUP_VIDEO)
    {
        /* video */
    #if defined(__MMI_VIDEO_PLAY_SUPPORT__)

        FMGR_FILTER file_type;
        S32 ret;
        
        jump = 5;        
    
        FMGR_FILTER_INIT(&file_type);
        ret = srv_fmgr_types_find_type_by_filepath((WCHAR*)filename);
        if(ret >= 0)
        {
            FMGR_FILTER_SET(&file_type, ret);
            ret = 0;
        }
    
        if (FMGR_FILTER_IS_SET(&file_type, FMGR_TYPE_3GP))
        {
            resource_type = GDI_IMAGE_TYPE_3GP_FILE;
        }
        else if (FMGR_FILTER_IS_SET(&file_type, FMGR_TYPE_MP4))
        {
            resource_type = GDI_IMAGE_TYPE_MP4_FILE;
        }
        else if (FMGR_FILTER_IS_SET(&file_type, FMGR_TYPE_AVI))
        {
            resource_type = GDI_IMAGE_TYPE_AVI_FILE;
        }
        else if (FMGR_FILTER_IS_SET(&file_type, FMGR_TYPE_MPG))
        {
            resource_type = GDI_IMAGE_TYPE_MPG_FILE;
        }
        else if (FMGR_FILTER_IS_SET(&file_type, FMGR_TYPE_3G2))
        {
            resource_type = GDI_IMAGE_TYPE_3G2_FILE;
        } 
        else if (FMGR_FILTER_IS_SET(&file_type, FMGR_TYPE_RM) ||
                 FMGR_FILTER_IS_SET(&file_type, FMGR_TYPE_RMVB) ||
                 FMGR_FILTER_IS_SET(&file_type, FMGR_TYPE_RV))
        {
            resource_type = GDI_IMAGE_TYPE_RM_FILE;
        }
        else
        {
            errcode = MDI_RES_VDOPLY_ERR_UNSUPPORTED_FORMAT;
            errstr = STR_GLOBAL_UNSUPPORTED_FORMAT;
            goto final;
        }

    #endif /* __MMI_VIDEO_PLAY_SUPPORT__ */ 

    }
    else
    {
        /* do not have limit */
        goto final;
    }

    /* check if has limit */
    while (1)
    {
        if (*check_start_ptr == resource_type)
        {
            /* find limit */
            break;
        }

        check_start_ptr += jump;
        if (*check_start_ptr == END_LIMIT_ITEM)
        {
            /* all checked, no limitation */
            goto final;
        }
    };

    if (res_group_type == FMGR_GROUP_IMAGE)
    {
        check_start_ptr++;
        check_file_size = *check_start_ptr++;
        check_image_width = *check_start_ptr++;
        check_image_height = *check_start_ptr;

        /*******************************************/
        /* Image size checking                     */
        /*******************************************/
        
        if (check_image_width!=0 || check_image_height!=0)
        {
            result = gdi_image_get_dimension_file(filename, &image_width, &image_height);

            if ((result < 0) ||
                ( image_width == 0 || image_height == 0))
            {
                if (result == GDI_IMAGE_ENCODER_ERR_MEMORY_NOT_ENOUGH)
                {
                    errcode = result;
                    errstr = STR_GLOBAL_NOT_ENOUGH_MEMORY;
                }
                else if (result == GDI_IMAGE_ERR_INVALID_IMG_TYPE ||
					image_width == 0 || 
					image_height == 0)
                {
                    errcode = GDI_IMAGE_ERR_INVALID_IMG_TYPE;
                    errstr = STR_GLOBAL_INVALID_FORMAT;
                }
                else
                {
                    errcode = result;
                    errstr = STR_GLOBAL_UNSUPPORTED_FORMAT;
                }
                goto final;
            }

            /* checking */
            if (((check_image_width != 0) && (image_width > check_image_width)) ||
                ((check_image_height != 0) && (image_height > check_image_height)))
            {
                errcode = GDI_IMAGE_ERR_IMAGE_TOO_LARGE;
                errstr = STR_ID_FMGR_FILE_LIMIT_IMAGE_TOO_LARGE;
                goto final;
            }
        }

        /*******************************************/
        /* Image file size checking (width/height) */
        /*******************************************/
        
        fs_handle = DRM_open_file((PU16) filename, FS_READ_ONLY, DRM_PERMISSION_DISPLAY);

        if (fs_handle < 0)
        {
            errcode = fs_handle;
            goto final;
        }
        else
        {
            DRM_file_size(fs_handle, (PU32) & file_size );

            if (file_size == 0)
            {
                DRM_close_file(fs_handle);
                errcode = GDI_IMAGE_ERR_FILE_FORMAT_WRONG;
                errstr = STR_GLOBAL_UNSUPPORTED_FORMAT;
                goto final;
            }

            DRM_close_file(fs_handle);
        }

        if ((check_file_size != 0) && (file_size > (check_file_size * 1024)))
        {
            errcode = GDI_IMAGE_ERR_IMAGE_TOO_LARGE;
            errstr = STR_ID_FMGR_FILE_LIMIT_FILE_TOO_LARGE;
            goto final;
        }
    }
    else if (res_group_type == FMGR_GROUP_VIDEO)
    {
        /* video */
    #if defined(__MMI_VIDEO_PLAY_SUPPORT__)

        check_start_ptr++;
        check_file_size = *check_start_ptr++;
        check_duration = *check_start_ptr++;
        check_image_width = *check_start_ptr++;
        check_image_height = *check_start_ptr;

        ext_ptr = (S8*)srv_fmgr_path_get_extension_ptr((WCHAR*)(filename));

         /*******************************************/
        /* Video file size checking                */
         /*******************************************/
        fs_handle = DRM_open_file((PU16) filename, FS_READ_ONLY, DRM_PERMISSION_PLAY);

        if (fs_handle < 0)
        {
            errcode = fs_handle;
            goto final;
        }
        else
        {
            DRM_file_size(fs_handle, (PU32) & file_size );

            if (file_size == 0)
            {
                DRM_close_file(fs_handle);

                errcode = MDI_RES_VDOPLY_ERR_UNSUPPORTED_FORMAT;
                errstr = STR_GLOBAL_UNSUPPORTED_FORMAT;
                goto final;
            }

            DRM_close_file(fs_handle);
        }

        if ((check_file_size != 0) && (file_size > (check_file_size * 1024)))
        {
            errcode = MDI_RES_VDOPLY_ERR_FILE_TOO_LARGE;
            errstr = STR_ID_FMGR_FILE_LIMIT_FILE_TOO_LARGE;
            goto final;
        }

         /*******************************************/
        /* Vdieo info checking  (width/height/dur) */
         /*******************************************/
        result = mdi_video_ply_open_clip_file(filename, &vdo_info);

        if (result < 0)
        {
            errcode = result;
            errstr = mdi_util_get_mdi_error_info(result,&event_id);
            goto final;
        }
        else
        {
            mdi_video_ply_close_clip_file();
        }

        if ((check_duration != 0) && (vdo_info.total_time_duration / 1000 > check_duration))
        {
            errcode = MDI_RES_VDOPLY_ERR_FILE_TOO_LARGE;
            errstr = STR_ID_FMGR_FILE_LIMIT_VIDEO_TOO_LONG;
            goto final;
        }

        if (((check_image_width != 0) && (vdo_info.width > check_image_width)) ||
            ((check_image_height != 0) && (vdo_info.height > check_image_height)))
        {
            errcode = MDI_RES_VDOPLY_ERR_FILE_TOO_LARGE;
            errstr = STR_ID_FMGR_FILE_LIMIT_VIDEO_TOO_LARGE;
            goto final;
        }

    #else /* __MMI_VIDEO_PLAY_SUPPORT__ */ 
        errcode = MDI_RES_VDOPLY_ERR_UNSUPPORTED_FORMAT;
        errstr = STR_GLOBAL_UNSUPPORTED_FORMAT;
    #endif /* __MMI_VIDEO_PLAY_SUPPORT__ */ 
    }

final:
    if(errcode != 0)
    {
        if(errstr == 0)
            errstr = srv_fmgr_fs_error_get_string(errcode);
    }
    if(errorno_p)
        *errorno_p = errcode;

    return errstr;
}

/*****************************************************************************
 * FUNCTION
 *  mmi_fmgr_util_file_limit_check
 * DESCRIPTION
 *  util function for some api to check file's limit
 *  to gather all api's file decode limit here
 * PARAMETERS
 *  array_ptr           [IN]        Array pointer
 *  filename            [IN]        Filename
 *  error_str_pp        [OUT]       Error string pointer's ptr
 * RETURNS
 * BOOL
 *****************************************************************************/
BOOL mmi_fmgr_util_file_limit_check(const S32 *array_ptr, PS8 filename, PS8 *error_str_pp)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    static S8 g_fmgr_file_limit_error_str[FILE_LIMIT_ERROR_BUF_SIZE];

    U16 string_id;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    string_id = mmi_fmgr_util_file_limit_check2(array_ptr, filename, NULL);

    /* assign buffer */
    *error_str_pp = g_fmgr_file_limit_error_str;
    memset(g_fmgr_file_limit_error_str, 0, FILE_LIMIT_ERROR_BUF_SIZE);

    if(string_id)
    {
        mmi_ucs2ncpy(g_fmgr_file_limit_error_str,
                     (PS8)(GetString(string_id)),
                     FILE_LIMIT_ERROR_STR_LEN);
        g_fmgr_file_limit_error_str[FILE_LIMIT_ERROR_BUF_SIZE-1] = 0;
        g_fmgr_file_limit_error_str[FILE_LIMIT_ERROR_BUF_SIZE-2] = 0;
        return FALSE;
    }
    return TRUE;
}


U16 mmi_fmgr_query_custom_icon(BOOL is_large, U16 filetype, U16 grouptype, S8* filepath)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U16 image_id = IMG_ID_FMGR_ICON_FILE_TYPE_UNKNOWN;
    U8 perm = 0;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/    
#ifdef __DRM_SUPPORT__
    if (grouptype == FMGR_GROUP_VIDEO ||
        grouptype == FMGR_GROUP_AUDIO)
    {
        perm = DRM_PERMISSION_PLAY;
    }
    else if (grouptype == FMGR_GROUP_IMAGE)
    {
        perm = DRM_PERMISSION_DISPLAY;
    }
#ifdef __J2ME__
    else if (filetype == FMGR_TYPE_JAD ||
             filetype == FMGR_TYPE_JAR)
    {
        perm = DRM_PERMISSION_EXECUTE;
    }
#endif /* __J2ME__ */ 

    mmi_rmgr_query_icon((PU16)filepath, perm, &image_id);
#endif /* __DRM_SUPPORT__ */

    if (image_id != IMG_ID_FMGR_ICON_FILE_TYPE_UNKNOWN)
        return image_id;    
    else
        return is_large ? IMG_ID_FMGR_FILE_TYPE_UNKNOWN : IMG_ID_FMGR_ICON_FILE_TYPE_UNKNOWN;

}


#ifdef __MMI_IMPS__
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
/* under construction !*/
#ifdef __MMI_TOUCH_SCREEN__
/* under construction !*/
#endif 
/* under construction !*/
#endif

#if defined(__MMI_FMGR_MULTI_SELECT_SUPPORT__) && defined(__MMI_BT_SEND_SUPPORT__)

static S32 mmi_fmgr_bt_fill_next(U32 fmgr_id, mmi_fmgr_multi_sel_item_struct* item)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 lock_ret;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    while(1)
    {
        lock_ret = mmi_fmgr_multi_sel_lock_curr(fmgr_id, item);
        if(lock_ret >= 0)
        {
            break;
        }
        if(lock_ret == FS_NO_MORE_FILES)
        {
            break;
        }
        mmi_fmgr_multi_sel_process_next(fmgr_id);
    }

    return lock_ret;
}

static void mmi_fmgr_bt_multi_send_next(mmi_id cui_id, U32 fmgr_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_fmgr_multi_sel_item_struct  item;
    cui_bt_sending_obj_struct       obj;

    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    if(mmi_fmgr_bt_fill_next(fmgr_id, &item) >= 0)
    {
        memset(&obj, 0, sizeof(obj));
        obj.data.obj_type = CUI_BT_SENDIND_USE_FILE;
        obj.data.u.file.path = (U16*)item.filepath;

        cui_bt_sending_continue(cui_id, &obj);
        mmi_fmgr_multi_sel_unlock_curr(fmgr_id, &item);
    }
    else
    {
        cui_bt_sending_continue(cui_id, NULL);
    }
}

static mmi_ret mmi_fmgr_bt_send_proc(mmi_group_event_struct *param)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    U32 fmgr_id = (U32)param->user_data;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    switch (param->evt_id)
    {
        case EVT_ID_CUI_BT_SENDING_SUCC:
            /* Unmark current file, move to next */
            mmi_fmgr_multi_sel_unmark_curr(fmgr_id);
            /* Send it */
            mmi_fmgr_bt_multi_send_next(param->sender_id, fmgr_id);
            break;
        
        case EVT_ID_CUI_BT_SENDING_FAIL:
            /* Move to next item */
            mmi_fmgr_multi_sel_process_next(fmgr_id);
            /* Send it */
            mmi_fmgr_bt_multi_send_next(param->sender_id, fmgr_id);
            break;

        case EVT_ID_CUI_BT_SENDING_DONE:
            cui_bt_sending_close(param->sender_id);
            break;
    }
    return MMI_RET_OK;
}

void mmi_fmgr_bt_multi_send(U32 fmgr_ms_id)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_id adp_grp, cui_id;
    cui_bt_sending_para_struct para;
    cui_bt_sending_obj_struct obj;
    mmi_fmgr_multi_sel_item_struct item;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    /* Filter out non-sendable */
    mmi_fmgr_multi_sel_filter(fmgr_ms_id, MMI_FMGR_MULTI_SEL_NON_SENDABLE);

    if (mmi_fmgr_bt_fill_next(fmgr_ms_id, &item) < 0)
    {
        mmi_popup_display_simple((WCHAR*)GetString(FMGR_FS_PATH_OVER_LEN_ERROR_TEXT), MMI_EVENT_FAILURE, GRP_ID_ROOT, NULL);
        return;
    }
    memset(&para, 0, sizeof(para));
    para.total = mmi_fmgr_multi_sel_get_remain_count(fmgr_ms_id);
    para.obj = &obj;
#ifdef __MMI_BT_AUTO_PROMPT_SWITCH__
    para.option = CUI_BT_SENDIND_OPT_DEFAULT_DEVICE;
#endif /* __MMI_BT_AUTO_PROMPT_SWITCH__ */

    memset(&obj, 0, sizeof(obj));
    obj.data.obj_type = CUI_BT_SENDIND_USE_FILE;
    obj.data.u.file.path = (U16*)item.filepath;
    
    adp_grp = mmi_frm_group_create(GRP_ID_ROOT, GRP_ID_AUTO_GEN, (mmi_proc_func)mmi_fmgr_bt_send_proc, (void*)fmgr_ms_id);
    mmi_frm_group_enter(adp_grp, MMI_FRM_NODE_SMART_CLOSE_FLAG);

    cui_id = cui_bt_sending_create(adp_grp);
    cui_bt_sending_run(cui_id, &para);
    mmi_fmgr_multi_sel_unlock_curr(fmgr_ms_id, &item);    
}

#endif /* defined(__MMI_FMGR_MULTI_SELECT_SUPPORT__) && defined(__MMI_BT_SEND_SUPPORT__) */

#if defined(__DM_LAWMO_SUPPORT__)
static void fmgr_dm_do_format(void);
static void fmgr_dm_lawmo_format_rsp_hdlr(void *info)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    mmi_fmt_format_rsp_strcut   *msg;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    msg = (mmi_fmt_format_rsp_strcut*) info;

    if(msg->result == FS_DEVICE_BUSY)
    {
        /* retry for device busy */
        StartTimer(FMGR_SCR_TIMER, 1000, fmgr_dm_do_format);
        return;
    }            

    mmi_dmui_lawmo_report(MMI_DMUI_APP_ID_FMGR, 
        MMI_DMUI_CMD_LAWMO_WIPE, 
        (msg->result >= 0) ? MMI_DMUI_RESULT_SUCCESS : MMI_DMUI_RESULT_FAILURE);
}

static void fmgr_dm_do_format(void)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    S32 phone_drv;
    S32 ret;
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/
    phone_drv = FS_GetDrive(FS_DRIVE_V_NORMAL, 2, FS_DRIVE_V_NORMAL);

    ret = mmi_fmgr_util_send_format_req((U8)phone_drv, FS_FORMAT_HIGH, (PsFuncPtr) fmgr_dm_lawmo_format_rsp_hdlr);
    if(ret < 0)
    {
        // start a timer for retry
        StartTimer(FMGR_SCR_TIMER, 1000, fmgr_dm_do_format);
    }
}

static void fmgr_dm_lawmo_hdlr(mmi_dmui_app_id_enum app_id, mmi_dmui_cmd_enum cmd)
{
    /*----------------------------------------------------------------*/
    /* Local Variables                                                */
    /*----------------------------------------------------------------*/
    
    /*----------------------------------------------------------------*/
    /* Code Body                                                      */
    /*----------------------------------------------------------------*/

    ASSERT(app_id == MMI_DMUI_APP_ID_FMGR);
    switch(cmd)
    {
    case MMI_DMUI_CMD_LAWMO_WIPE:
        fmgr_dm_do_format();
        break;

    default:
        // not support cmd, report fail.
        mmi_dmui_lawmo_report(app_id, cmd, MMI_DMUI_RESULT_FAILURE);
        break;
    }
}

#endif


